<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="/style/basic_layout.css" rel="stylesheet" type="text/css">
    <link href="/style/common_style.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/js/jquery/jquery.js"></script>
    <script type="text/javascript" src="/js/plugins/artDialog/jquery.artDialog.js?skin=blue"></script>
    <script type="text/javascript" src="/js/plugins/My97DatePicker/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="/js/commonAll.js"></script>
    <script type="text/javascript">
        $(function () {
            $("input[name='beginDate']").click(function () {
                WdatePicker({
                    readOnly:true,
                    maxDate:new Date()
                })
            })
            $("input[name='endDate']").click(function () {
                WdatePicker({
                    readOnly:true,
                    minDate: $("input[name='beginDate']").val(),
                    maxDate:new Date()
                })
            })

            $(".btn_audit").click(function () {
                var url = $(this).data("url");
                showDialog("是否确定审核?",function () {
                    $.get(url,function (data) {
                        showDialog("审核成功",function () {
                            location.reload();
                        })
                    })
                },true)
            })

        })
    </script>
    <title>WMS-入库管理</title>
    <style>
        .alt td{ background:black !important;}
    </style>
</head>
<body>
<form id="searchForm" action="/stockIncomeBill/list.do" method="post">
    <div id="container">
        <div class="ui_content">
            <div class="ui_text_indent">
                <div id="box_border">
                    <div id="box_top">搜索</div>
                    <div id="box_center">
                        业务时间
                        <fmt:formatDate value="${qo.beginDate}" var="beginDate"/>
                        <fmt:formatDate value="${qo.endDate}" var="endDate"/>
                        <input name="beginDate" value="${beginDate}" class="ui_input_txt02 Wdate" > ~
                        <input name="endDate" value="${endDate}" class="ui_input_txt02 Wdate" >

                        仓库
                        <select id="depotId" class="ui_select01" name="depotId">
                            <option value="-1">全部</option>
                                <c:forEach items="${depots}" var="ele">
                                    <option value="${ele.id}">${ele.name}</option>
                                </c:forEach>
                        </select>

                        状态:
                        <select id="status" class="ui_select01" name="status">
                            <option value="-1">全部</option>
                            <option value="1">未审核</option>
                            <option value="2">已审核</option>
                        </select>
                        <script>
                            $(function () {
                                $("#depotId option[value='${qo.depotId}']").prop("selected",true);
                                $("#status option[value='${qo.status}']").prop("selected",true);
                            })
                        </script>

                    </div>
                    <div id="box_bottom">
                        <input type="button" value="查询" data-page="1" class="ui_input_btn01 btn_check"/>
                        <input type="button" value="新增" class="ui_input_btn01 btn_input"
                               data-url="/stockIncomeBill/input.do">
                    </div>


                </div>
            </div>
        </div>
        <div class="ui_content">
            <div class="ui_tb">
                <table class="table" cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
                    <tr>
                        <th width="30"><input type="checkbox" id="all" /></th>
                        <th>仓库单号</th>
                        <th>业务时间</th>
                        <th>仓库</th>
                        <th>总金额</th>
                        <th>总数量</th>
                        <th>录入人</th>
                        <th>审核人</th>
                        <th>状态</th>
                        <th></th>
                    </tr>
                    <c:forEach items="${result.list}" var="list" varStatus="vs">
                        <tr>
                            <td><input type="checkbox" class="acb" /></td>
                            <td>${list.sn}</td>
                            <td><fmt:formatDate value="${list.vdate}"  pattern="yyyy-MM-dd"/></td>
                            <td>${list.depot.name}</td>
                            <td>${list.totalAmount}</td>
                            <td>${list.totalNumber}</td>
                            <td>${list.inputUser.name}</td>
                            <td>${list.auditor.name}</td>
                            <td>
                                <c:choose>
                                    <c:when test="${list.status == 1}">
                                        <span style="color:green">未审核</span>
                                    </c:when>
                                    <c:when test="${list.status == 2}">
                                        <span style="color:red">已审核</span>
                                    </c:when>
                                </c:choose>
                            </td>
                            <td>
                                <c:choose>
                                    <c:when test="${list.status == 1}">
                                        <a href="/stockIncomeBill/input.do?id=${list.id}">编辑</a>
                                        <a href="javascript:"  class="btn_delete"
                                           data-url="/stockIncomeBill/delete.do?id=${list.id}">删除</a>
                                        <a href="javascript:" class="btn_audit"
                                         data-url="/stockIncomeBill/audit.do?id=${list.id}">审核</a>
                                    </c:when>

                                    <c:when test="${list.status == 2}">
                                        <a href="/stockIncomeBill/view.do?id=${list.id}">查看</a>
                                    </c:when>
                                </c:choose>
                            </td>
                        </tr>
                    </c:forEach>
                </table>
            </div>
            <jsp:include page="/WEB-INF/views/common/page.jsp"/>
        </div>
    </div>
</form>
</body>
</html>